package com.dingreading.cloud.admin.util;

import com.dingreading.cloud.admin.entity.StoreProjectCycle;
import com.dingreading.cloud.admin.entity.StoreProjects;
import com.dingreading.cloud.common.util.KitUtil;
import com.dingreading.cloud.common.util.NepUtil;

public class ProjectCycleUtil {

    public static StoreProjects newProject(
            String storeUid, String storeName, String projectName, Integer lessonStatus, Integer freeStatus, Integer maxOrderNum,
            Integer source, String remark, String staffUid, String staffName, String cooperationType, String operationType,
            Integer isPay, String subjectUid, String subjectUidName
    ) {
        StoreProjects data = new StoreProjects();
        data.setUid(KitUtil.getUuid());
        data.setOrderNum(maxOrderNum);
        data.setStoreUid(storeUid);
        data.setStoreName(storeName);
        data.setProjectName(projectName);
        data.setLessonStatus(lessonStatus);
        if (lessonStatus.equals(1))
            data.setFreeStatus(freeStatus);
        else
            data.setFreeStatus(0);
        data.setCooperationType(cooperationType);
        data.setOperationType(operationType);
        data.setSource(source);
        data.setEnabled(1);
        data.setAddStaffUid(staffUid);
        data.setAddStaffName(staffName);
        data.setRemark(NepUtil.nullToZero(remark));
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        data.setIsPay(isPay);
        data.setSubjectUid(subjectUid);
        data.setSubjectUidName(subjectUidName);
        return data;
    }

    public static StoreProjectCycle newCycle(
            String storeUid, String projectUid, String cycleName, Integer days, Integer lessons,
            Double totalAmount, Double unitAmount, Integer orderNum, Integer source, String staffUid, String staffName
    ) {
        StoreProjectCycle data = new StoreProjectCycle();
        data.setStoreUid(storeUid);
        data.setProjectUid(projectUid);
        data.setUid(KitUtil.getUuid());
        data.setCycleName(cycleName);
        // 可排活动才能设置活动次数
        data.setDays(days);
        data.setLessons(lessons);
        data.setUnitAmount(unitAmount);
        data.setTotalAmount(totalAmount);
        data.setOrderNum(orderNum);
        data.setSource(source);
        data.setEnabled(1);

        data.setAddStaffUid(staffUid);
        data.setAddStaffName(staffName);
        data.setLastStaffUid(staffUid);
        data.setLastStaffName(staffName);
        return data;
    }

}
